package com.innovation.chengzhangriji.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewPager;

import com.innovation.chengzhangriji.Config;
import com.innovation.chengzhangriji.R;
import com.innovation.chengzhangriji.ui.widget.GuideIndicator;
import com.innovation.chengzhangriji.ui.widget.GuideViewPagerAdapter;
import com.umeng.analytics.MobclickAgent;

public class GuideActivity extends BaseActivity implements GuideViewPagerAdapter.OnClickGuideViewListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guide);
        GuideIndicator guideIndicator = (GuideIndicator) findViewById(R.id.indicator);
        ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
        viewPager.setAdapter(new GuideViewPagerAdapter(this, this));
        viewPager.setOnPageChangeListener(guideIndicator);
    }

    @Override
    protected void onPageStart() {
        MobclickAgent.onPageStart(Config.UMENG_PAGE_GUIDE);
    }

    @Override
    protected void onPageEnd() {
        MobclickAgent.onPageEnd(Config.UMENG_PAGE_GUIDE);
    }

    @Override
    public void onClickGuideViewStart() {
        Config.setGuide(this, true);
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
        finish();
    }
}
